﻿using IQKS.AWP.BusinessObject;
using System;
using System.Data.SqlClient;


namespace IQKS.AWP.DataAccessLayer
{
    public class PayResponseDAL
    {
        public object SetPayResponse(PayResponseBO param)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@SetMethod",param.SetMethod),
                new SqlParameter("@CandidateID",param.CandidateID),
                new SqlParameter("@RespCode",param.RespCode),
                new SqlParameter("@RespMessage",param.RespMessage),
                new SqlParameter("@TxnId",param.TxnId),
                new SqlParameter("@EPGTxnId",param.EPGTxnId),
                new SqlParameter("@AuthIdCode",param.AuthIdCode),
                new SqlParameter("@RRN",param.RRN),
                new SqlParameter("@CVRespCode",param.CVRespCode),
                new SqlParameter("@Cookie",param.Cookie),
                new SqlParameter("@FDMSScore",param.FDMSScore),
                new SqlParameter("@FDMSResult",param.FDMSResult),
                new SqlParameter("@CreatedBy",param.CreatedBy),
                new SqlParameter("@PaymentAmount",param.PaymentAmount),



            };
                return DataUtils.ExecuteScalar("Usp_SetCandidatePayment", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public object SetPayResponseOffline(PayResponseBO param)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
            {

                new SqlParameter("@CandidateID",param.CandidateID),
                new SqlParameter("@PaymentAmount",param.PaymentAmount),
                new SqlParameter("@PaymentTypeID",param.PaymentTypeId),
                new SqlParameter("@BankPaymentTypeID",param.BankPaymentTypeId),
                new SqlParameter("@ChequeDDNo",param.ChequeNumber),
                new SqlParameter("@BankName",param.BankName),
                new SqlParameter("@BankBranch",param.BankBranch),
                new SqlParameter("@ChequeDDDate",param.ChequeDate),
                new SqlParameter("@Remarks",param.Remark),
                new SqlParameter("@UserID",param.UserId),
                new SqlParameter("@IsAssessorPayment",param.IsAssessorPayment),
            };
                return DataUtils.ExecuteScalar("usp_SetPaymentforOffline", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        //public object SetCandidatePaymentResponse(PayResponseBO param)
        //{
        //    try
        //    {

        //        SqlParameter[] parameters = new SqlParameter[]
        //    {
        //        new SqlParameter("@SetMethod",param.SetMethod),
        //        new SqlParameter("@CandidatePaymentID",param.CandidatePaymentID),
        //        new SqlParameter("@CandidateID",param.CandidateID),
        //        new SqlParameter("@PaymentAmount",param.PaymentAmount),
        //        new SqlParameter("@TxnId",param.TxnId),
        //        //new SqlParameter("@PaymentID",param.PaymentID),

        //    };
        //        return DataUtils.ExecuteScalar("Usp_SetCandidatePaymentResponse", parameters);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new ApplicationException(ex.Message);
        //    }
        //}
    }
}
